<?php
include("../db_connect.php");

include("../class/objName.php");
//include();
$sql = "SELECT * FROM tblswaping where addoff = '1' AND categories like'%Auto%' order by id DESC";
$result = mysql_query($sql)or die(mysql_error);
$brand_data = "";
if(mysql_num_rows($result)<1 ){
	echo '<div style="padding:10px;"><h3 style="color:white;" >No Item Found</h3></div>';
	die();
}

$obj = new objName();
echo "<table border='0' width='100%' style=''>";
echo "<tr style='background-color:gray; color:white;' > <td width='270px'>Title</td> <td >Description</td> <td>Content</td> </tr>";		
while($row = mysql_fetch_array($result)){
		$img = $obj->displayimg($row['filename'],true);
		echo "	<tr style=' border: 1px solid white;'>";
		echo "<td valign='top' width='100px'>
			<img id='' style='width:270px; height:180px;' src='images/vehicles/$img'>
			<div>Posted by:<a href='#' style='color:red;' > ".$row['fname'] ." ".$row['lname'] . "</a>";                                            
		echo "<p>Name:".$row['name']."</br> Time posted:".$row['timepost']."</br><a  id='edit_auto_list'  name=".$row['id']." href='#auto_cars' style='color:red'>Edit</a>|<a  id='edit_auto_list' onclick='autodelete(".$row['id'].")' name=".$row['id']." href='#auto_cars' style='color:red'>Delete</a></p>";
		echo "</div></td>";
		echo"<td valign='top' width='120px'><div width='120'>Brand:";
			
			if($row['categories']== "Auto"){
				echo"Price: ".$row['price']."</br>";
				echo"Brand: ".$row['brand']."</br>";
				echo"Model: ".$row['model']."</br>";
				echo"Condition: ".$row['conditions']."</br>";
				echo"Categories: ".$row['categories']."</br>";
				echo"Type: ".$row['types']."</br>";
				echo"Trans: ".$row['transmission']."</br>";
				echo"Fuel: ".$row['fuel']."</br>";
				
			}
			else{
				echo"Price: ".$row['price']."</br>";
				echo"Brand: ".$row['brand']."</br>";
				echo"Model: ".$row['model']."</br>";
				echo"Condition: ".$row['conditions']."</br>";
				echo"Categories: ".$row['categories']."</br>";
				echo"Parts: ".$row['cparts']."</br>";
				
			}
			
				
		echo "</div></td>";
		
		echo"<td valign='top'><p align='justify'>" .$row['description']."</p></td>";
	echo"</tr>";

}

echo "</table>";


?>				